package com.data.modules.online.cgform.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.data.common.util.ConvertUtils;
import com.data.modules.online.cgform.entity.OnlCgformEnhanceJava;
import com.data.modules.online.cgform.entity.OnlCgformEnhanceSql;
import com.data.modules.online.cgform.mapper.OnlCgformEnhanceJavaMapper;
import com.data.modules.online.cgform.mapper.OnlCgformEnhanceSqlMapper;
import com.data.modules.online.cgform.service.IOnlCgformEnhanceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class OnlCgformEnhanceServiceImpl implements IOnlCgformEnhanceService {
    @Autowired
    private OnlCgformEnhanceJavaMapper onlCgformEnhanceJavaMapper;
    @Autowired
    private OnlCgformEnhanceSqlMapper onlCgformEnhanceSqlMapper;

    private static /* synthetic */ java.lang.Object m147a(java.lang.invoke.SerializedLambda r4) {
        /*
        // Method dump skipped, instructions count: 580
        */
        throw new UnsupportedOperationException("Method not decompiled: com.data.modules.online.cgform.service.p013a.OnlCgformEnhanceServiceImpl.m147a(java.lang.invoke.SerializedLambda):java.lang.Object");
    }

@Override
public List<OnlCgformEnhanceJava> queryEnhanceJavaList(String cgformId) {
        LambdaQueryWrapper var2 = (LambdaQueryWrapper)(new LambdaQueryWrapper<OnlCgformEnhanceJava>()).eq(OnlCgformEnhanceJava::getCgformHeadId, cgformId);
        List var3 = this.onlCgformEnhanceJavaMapper.selectList(var2);
        return var3;
    }

    @Override
    public void saveEnhanceJava(OnlCgformEnhanceJava onlCgformEnhanceJava) {
        this.onlCgformEnhanceJavaMapper.insert(onlCgformEnhanceJava);
    }

    @Override
    public void updateEnhanceJava(OnlCgformEnhanceJava onlCgformEnhanceJava) {
        this.onlCgformEnhanceJavaMapper.updateById(onlCgformEnhanceJava);
    }

    @Override
    public void deleteEnhanceJava(String id) {
        this.onlCgformEnhanceJavaMapper.deleteById(id);
    }

    @Override
    public void deleteBatchEnhanceJava(List<String> idList) {
        this.onlCgformEnhanceJavaMapper.deleteBatchIds(idList);
    }

@Override
public boolean checkOnlyEnhance(OnlCgformEnhanceJava onlCgformEnhanceJava) {
        LambdaQueryWrapper<OnlCgformEnhanceJava> var2 = new LambdaQueryWrapper();
        var2.eq(OnlCgformEnhanceJava::getButtonCode, onlCgformEnhanceJava.getButtonCode());
        var2.eq(OnlCgformEnhanceJava::getCgformHeadId, onlCgformEnhanceJava.getCgformHeadId());
        var2.eq(OnlCgformEnhanceJava::getEvent, onlCgformEnhanceJava.getEvent());
        Integer var3 = this.onlCgformEnhanceJavaMapper.selectCount(var2);
        if (var3 != null) {
            if (var3 == 1 && ConvertUtils.isEmpty(onlCgformEnhanceJava.getId())) {
                return false;
            }

            if (var3 == 2) {
                return false;
            }
        }

        return true;
    }

@Override
public boolean checkOnlyEnhance(OnlCgformEnhanceSql onlCgformEnhanceSql) {
        LambdaQueryWrapper<OnlCgformEnhanceSql> var2 = new LambdaQueryWrapper();
        var2.eq(OnlCgformEnhanceSql::getButtonCode, onlCgformEnhanceSql.getButtonCode());
        var2.eq(OnlCgformEnhanceSql::getCgformHeadId, onlCgformEnhanceSql.getCgformHeadId());
        Integer var3 = this.onlCgformEnhanceSqlMapper.selectCount(var2);
        if (var3 != null) {
            if (var3 == 1 && ConvertUtils.isEmpty(onlCgformEnhanceSql.getId())) {
                return false;
            }

            if (var3 > 1) {
                return false;
            }
        }

        return true;
    }

@Override
public List<OnlCgformEnhanceSql> queryEnhanceSqlList(String cgformId) {
        LambdaQueryWrapper var2 = new LambdaQueryWrapper<OnlCgformEnhanceSql>()
                .eq(OnlCgformEnhanceSql::getCgformHeadId, cgformId);
        List var3 = this.onlCgformEnhanceSqlMapper.selectList(var2);
        return var3;
    }

    @Override
    public void saveEnhanceSql(OnlCgformEnhanceSql onlCgformEnhanceSql) {
        this.onlCgformEnhanceSqlMapper.insert(onlCgformEnhanceSql);
    }

    @Override
    public void updateEnhanceSql(OnlCgformEnhanceSql onlCgformEnhanceSql) {
        this.onlCgformEnhanceSqlMapper.updateById(onlCgformEnhanceSql);
    }

    @Override
    public void deleteEnhanceSql(String id) {
        this.onlCgformEnhanceSqlMapper.deleteById(id);
    }

    @Override
    public void deleteBatchEnhanceSql(List<String> idList) {
        this.onlCgformEnhanceSqlMapper.deleteBatchIds(idList);
    }
}
